package geocoding;

import java.util.ArrayList;

import android.util.Log;

//Holds latitude, longitude, the original osm-id and other stuff of each node, getters & setters
public class CustomNodes {

	
	private ArrayList<String> osmID = new ArrayList<String>();
	private ArrayList<Double> dlati = new ArrayList<Double>();
	private ArrayList<Double> dlongi = new ArrayList<Double>();
	private ArrayList<Boolean> has_description = new ArrayList <Boolean>();
	private ArrayList<Boolean> has_tags = new ArrayList <Boolean>();
	private ArrayList<Boolean> is_uni_landmark = new ArrayList<Boolean>();
	private ArrayList<Boolean> has_landmark = new ArrayList<Boolean>();
	private ArrayList<String> lmtitle = new ArrayList<String>();
	private ArrayList<Integer> dist_landmark_ID = new ArrayList<Integer>();
	private ArrayList<Integer> lmrank = new ArrayList<Integer>();
	private ArrayList<Boolean> is_silent = new ArrayList<Boolean>();
	private ArrayList<Boolean> has_tag_from_lm = new ArrayList<Boolean>();	
	private String TAG="URNav";
	
//	private ArrayList<String> tag = new ArrayList<String>();
//	private ArrayList<String> value = new ArrayList<String>();
	
	private String tag [][] = new String [4000][20];
	private String value [][] = new String [4000][20];
	
	private String tag_from_lm [][] = new String [4000][20];
	private String value_from_lm [][] = new String [4000][20];
	

	
//	Getters & setters
	
	
	public void addLmrank () {
		lmrank.add(10);
	}
	
	public void setLmrank (int ID, int rank) {
		lmrank.set(ID, rank);
	}
	
	public int getLmrank (int ID) {
		return lmrank.get(ID);
	}
	
	public void addHas_tag_from_lm(){
		has_tag_from_lm.add(false);
		}
	
	public void setHas_tag_from_lm(int ID){
		has_tag_from_lm.set(ID, true);
		}

	public void setTag (int ID, String Tag){
		
		for (int i = 0; i < 20; i++){
		if (tag[ID][i]==null){
			tag[ID][i] = Tag;
			break;
		}
		}
	}
	
	public void setTag_from_lm (int ID, String Tag){
		
		for (int i = 0; i < 20; i++){
		if (tag_from_lm[ID][i]==null){
			tag_from_lm[ID][i] = Tag;
			break;
		}
		}
	}
	
	public boolean getHas_tag_from_lm (int ID){
		return has_tag_from_lm.get(ID);
	}
	
	public void setValue (int ID, String Value){
		
		for (int i = 0; i < 20; i++){
		if (value[ID][i]==null){
			value[ID][i] = Value;
			break;
		}
		}
	}
	
	public void setValue_from_lm (int ID, String Value){
		
		for (int i = 0; i < 20; i++){
		if (value_from_lm[ID][i]==null){
			value_from_lm[ID][i] = Value;
			break;
		}
		}
	}
	
	public String getTag (int ID, int Pos){
		
		return tag[ID][Pos];
		
	}
	
	public String getTag_from_lm (int ID, int Pos){
		
		return tag_from_lm[ID][Pos];
		
	}
	
	public String getValue (int ID, int Pos){
		
		return value[ID][Pos];
		
	}
	
	public String getValue_from_lm (int ID, int Pos){
		
		return value_from_lm[ID][Pos];
		
	}
	
	
	public int getValueSize (int ID){
		for (int i = 0; i < 10; i++){
			if (value[ID][i]==null){
				return i;
			}
			
			
		}
		return 0;
	}
	
	public int getValueSize_from_lm (int ID){
		for (int i = 0; i < 10; i++){
			if (value_from_lm[ID][i]==null){
				return i;
			}
			
			
		}
		return 0;
	}
	
	
	public void setDist_landmark(int AnchorID, int distLMID){
		dist_landmark_ID.set(AnchorID, distLMID);
		
	}
	
	public void addSilent(int ID){
		is_silent.add(false);
		
	}
	
	public void setSilent(int ID){
		is_silent.set(ID, true);
		
	}
	
	public boolean getSilent(int ID){
		return is_silent.get(ID);
		
	}
	
	public int getDist_landmark(int AnchorID){
		return dist_landmark_ID.get(AnchorID);
	}
	
	public void addDist_landmark(){
		dist_landmark_ID.add(0);
	}
	
	
	public String getOsmID(int ID){
		return osmID.get(ID);
	}
	
	public double getDlati(int ID){
		return dlati.get(ID);
	}
	public double getDlongi(int ID){
		return dlongi.get(ID);
	}
	


	
	
	public boolean getHas_description(int ID){
		return has_description.get(ID);
	}
	
	public boolean getHas_tags(int ID){
		return has_tags.get(ID);
	}
	
	public void setHas_tags(int ID, boolean tags){
		has_tags.set(ID, tags);
	}
	
	public boolean getIs_uni_landmark(int ID){
		return is_uni_landmark.get(ID);
	}
	
	public boolean getHas_landmark(int ID){
		return has_landmark.get(ID);
	}
	
	
	public String getLmtitle(int ID){
		return lmtitle.get(ID);
	}
	
	public int getDiff_landmark_ID(int ID){
		return dist_landmark_ID.get(ID);
	}
	
	public int getSize(){
		return dlongi.size();
	}
	
	public int getPosition(String my_osm_id){
		int i=0;
		int j=0;
		
		for (i = 0; i < osmID.size(); i++) {
            if (my_osm_id.equals(osmID.get(i))) {
                    j=i;
            }
   
    }
		return j;
	}

	public void setOsmID (int ID, String osm){
		osmID.add(ID, osm);
	}

	public void setDlati (int ID, double lati){
		dlati.add(ID, lati);
	}
	
	public void setDlongi (int ID, double longi){
		dlongi.add(ID, longi);
	}
	

	
	public void setIs_uni_landmark(int ID, boolean is_landmark){
		is_uni_landmark.set(ID, is_landmark);
	}
	
	public void setHas_landmark(int ID, boolean haslandmark){
		has_landmark.set(ID, haslandmark);
	}
	
	public void addHas_landmark(){
		has_landmark.add(false);
	}
	
	public void setHas_description(int ID, boolean has_desc){
		has_description.set(ID, has_desc);
	}
	
	

	

	public void setLmtitle (int ID, String title){
		lmtitle.set(ID, title);	
	}
	
	public void addLmtitle (int ID){
		lmtitle.add(ID, " ");	
	}

	public void addIs_uni_landmark (int ID, boolean is_landmark){
		is_uni_landmark.add(ID, is_landmark);	
	}
	
	public void addHas_description(int ID, boolean has_desc){
		has_description.add(ID, has_desc);
	}

	public void addHas_tags(int ID, boolean has_desc){
		has_tags.add(ID, has_desc);
	}
}
